Northwoods.GoWPF 2.2.4 Assembly
Load<NodeDataType,LinkDataType>(XContainer,Func<XElement,NodeDataType>,Func<XElement,LinkDataType>) Method

this must be a class inheriting from GraphLinksModelNodeData<NodeKey>
this must be a class inheriting from GraphLinksModelLinkData<NodeKey,PortKey>
the XContainer holding all of the data
a function that takes an XElement and returns either a newly constructed object of type NodeDataType or null if that XElement is to be ignored
a function that takes an XElement and returns either a newly constructed object of type LinkDataType or null if that XElement is to be ignored
Given a Linq for XML XContainer holding node and link data, replace this model's NodesSource and LinksSource collections with collections of new node data and new link data.
Syntax

Parameters

root
the XContainer holding all of the data
nodedataallocator
a function that takes an XElement and returns either a newly constructed object of type NodeDataType or null if that XElement is to be ignored
linkdataallocator
a function that takes an XElement and returns either a newly constructed object of type LinkDataType or null if that XElement is to be ignored

Type Parameters

NodeDataType
this must be a class inheriting from GraphLinksModelNodeData<NodeKey>
LinkDataType
this must be a class inheriting from GraphLinksModelLinkData<NodeKey,PortKey>
Remarks

This will iterate over all of the child elements of the root container, calling nodedataallocator on each one. If that function returns non-null, it calls LoadFromXElement on the new data and then adds it to the NodesSource collection. It will then iterate again over all of the child elements of the root container, calling linkdataallocator on each one. If that function returns non-null, it calls GraphLinksModelLinkData<NodeKey,PortKey>.LoadFromXElement on the new data and then adds it to the LinksSource collection.

All of the changes to this model are performed within a transaction.

This does not set the IsModified property to false. You may wish to do so, depending on your application requirements. You might also wish to clear the UndoManager.

Requirements
See Also

Reference

GraphLinksModel<NodeType,NodeKey,PortKey,LinkType> Class
GraphLinksModel<NodeType,NodeKey,PortKey,LinkType> Members
Overload List

 

 


© Northwoods Software 2017. All Rights Reserved.

Send Feedback